﻿using blackhouse.NemoBlog.Web;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using blackhouse.WebNemo.Web;
using blackhouse.BlackApart.WebNemo;
using blackhouse.NemoBlog.Business;

namespace blackhouse.StareKino.Web.Events {
    public static class NemoBlogPostExtension {

        public static DateTime GetEventDate(this DTNemoBlogPost dtpost) {
            return dtpost.Post.GetEventDate();
        }

        public static DateTime GetEventDate(this NemoBlogPost post) {
            return post.IsNotNull("data") ? post.GetDateTime("data") : post.PublishDate;
        }

        public static string GetPhotoUrl(this DTNemoBlogPost dtpost) {
            return dtpost.Post.GetPhotoUrl();
        }

        public static string GetPhotoUrl(this NemoBlogPost post) {
            return (post.IsNotNull("zdjecie")) ? post.GetImageUrl("zdjecie", new System.Drawing.Size(420, 1000)) : String.Empty;
        }

        public static bool HaveLocation(this DTNemoBlogPost dtpost) {
            return dtpost.Post.HaveLocation();
        }

        public static bool HaveLocation(this NemoBlogPost post) {
            return post.IsNotNull("lokalizacja");
        }

        public static NemoLocation GetLocation(this DTNemoBlogPost dtpost) {
            return dtpost.Post.GetLocation();
        }

        public static NemoLocation GetLocation(this NemoBlogPost post) {
            return post.GetRecord<NemoLocation>("lokalizacja");
        }

    }
}